package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RoutesMapper;
import com.ruoyi.system.domain.Routes;
import com.ruoyi.system.service.IRoutesService;

/**
 * 路线Service业务层处理
 *
 * @author Y.C
 * @date 2024-02-21
 */
@Service
public class RoutesServiceImpl extends ServiceImpl<RoutesMapper,Routes> implements IRoutesService
{
    @Autowired
    private RoutesMapper routesMapper;

    /**
     * 查询路线
     *
     * @param routeId 路线主键
     * @return 路线
     */
    @Override
    public Routes selectRoutesByRouteId(Long routeId)
    {
        return routesMapper.selectRoutesByRouteId(routeId);
    }

    /**
     * 查询路线列表
     *
     * @param routes 路线
     * @return 路线
     */
    @Override
    public List<Routes> selectRoutesList(Routes routes)
    {
        return routesMapper.selectRoutesList(routes);
    }

    /**
     * 新增路线
     *
     * @param routes 路线
     * @return 结果
     */
    @Override
    public int insertRoutes(Routes routes)
    {
        routes.setCreateTime(DateUtils.getNowDate());
        return routesMapper.insertRoutes(routes);
    }

    /**
     * 修改路线
     *
     * @param routes 路线
     * @return 结果
     */
    @Override
    public int updateRoutes(Routes routes)
    {
        routes.setUpdateTime(DateUtils.getNowDate());
        return routesMapper.updateRoutes(routes);
    }

    /**
     * 批量删除路线
     *
     * @param routeIds 需要删除的路线主键
     * @return 结果
     */
    @Override
    public int deleteRoutesByRouteIds(Long[] routeIds)
    {
        return routesMapper.deleteRoutesByRouteIds(routeIds);
    }

    /**
     * 删除路线信息
     *
     * @param routeId 路线主键
     * @return 结果
     */
    @Override
    public int deleteRoutesByRouteId(Long routeId)
    {
        return routesMapper.deleteRoutesByRouteId(routeId);
    }
}
